<template>
    <a-modal :confirm-loading="modalOption.loading" :okText="modalOption.okText" @ok="modalOption.onOk"
             @cancel="modalOption.onCancel" :cancelText="modalOption.cancelText" :width="modalOption.width" :visible="visible"
             :title="modalOption.title">

    </a-modal>
</template>
<script lang="ts">
import {Component, Prop, Vue, Watch} from 'vue-property-decorator';
import { h } from "vue";
import nextApi from "@/api/nextApi";
import AddOrEdit from "@/views/reportMgt/productionDailyReport/components/addOrEdit.vue";
@Component({
    name:'bigTable',
    components: {
        AddOrEdit
    }
})

export default class extends Vue {
    @Prop({ default: false }) visible!: boolean;
    @Prop({ default: "" }) editId!: string;
    @Prop({default:''}) date!:string;
    //tabs配置
    tabsData:string[] = ['前处理','提取','喷干','过筛','混一','混二','制粒','小袋分装','大袋分装','小袋外包','大袋外包']
    //组件配置
    modalOption: any = {
        width: "98%",
        title: "生产日报表",
        okText: "确定",
        cancelText: "取消",
        loading: false,
        onOk: () => {
            this.closeModal();
        },
        onCancel: () => {
            this.closeModal();
        },
    };
    //部分通用table配置
    tableOption:any = {
        loading:false,
        tableColumns: [],
        tableData:[],
    }

    curTab:string = '前处理'
    @Watch("visible")
    visibleChange(n){
        if(n) this.tabChange(this.curTab)
    }
    beforeUpload(file: any) {
        return;

        let formData = new FormData();
        // formData.append("file", file);
        // formData.append("type", this.rawTypeKey);
        // this.uploadAccount(formData);
        return false;
    }
    tabChange(e){
        this.curTab = e
        this.changeColumn()
    }
    //配置tableColumns
    materialType = '饮片'
    type = '半成品'
    changeColumn(){
        switch (this.curTab) {
            case '前处理':
                this.tableOption.tableColumns = [
                    {
                        title: "日期",
                        dataIndex: "productionDate",
                        key: "productionDate",
                        align: "center",
                    },
                    {
                        title: "班次",
                        dataIndex: "shift",
                        key: "shift",
                        align: "center",
                    },
                    {
                        title: "班长",
                        dataIndex: "shiftLeader",
                        key: "shiftLeader",
                        align: "center",
                    },
                    {
                        title: "标准",
                        dataIndex: "standard",
                        key: "standard",
                        align: "center",
                    },
                    {
                        title: "品名",
                        dataIndex: "productName",
                        key: "productName",
                        align: "center",
                    },
                    {
                        title: "批号",
                        dataIndex: "batchNumber",
                        key: "batchNumber",
                        align: "center",
                    },
                    {
                        title: "原药材品名",
                        dataIndex: "rawMaterialName",
                        key: "rawMaterialName",
                        align: "center",
                    },
                    {
                        title: "药材备注",
                        dataIndex: "notice",
                        key: "notice",
                        align: "center",
                    },
                    {
                        title: "原药流水号",
                        dataIndex: "rawMaterialSerialNumber",
                        key: "rawMaterialSerialNumber",
                        align: "center",
                    },
                    {
                        title: "药材分类码",
                        dataIndex: "rawMaterialClassificationCode",
                        key: "rawMaterialClassificationCode",
                        align: "center",
                    },
                    {
                        title: "药材来料批号",
                        dataIndex: "rawMaterialBatchNumber",
                        key: "rawMaterialBatchNumber",
                        align: "center",
                    },
                    {
                        title: "产地",
                        dataIndex: "origin",
                        key: "origin",
                        align: "center",
                    },
                    {
                        title: "生产类型(CW/SY/G)",
                        dataIndex: "productionType",
                        key: "productionType",
                        align: "center",
                    },
                    {
                        title: "生产流水号",
                        dataIndex: "productionSerialNumber",
                        key: "productionSerialNumber",
                        align: "center",
                    },
                    {
                        title: "物料码",
                        dataIndex: "materialCode",
                        key: "materialCode",
                        align: "center",
                    },
                    {
                        title: "总投料量",
                        dataIndex: "totalInputAmount",
                        key: "totalInputAmount",
                        align: "center",
                    },
                    {
                        title: "总产出量",
                        dataIndex: "totalOutputAmount",
                        key: "totalOutputAmount",
                        align: "center",
                    },
                    {
                        title: "当班投料量",
                        dataIndex: "shiftInputAmount",
                        key: "shiftInputAmount",
                        align: "center",
                    },
                    {
                        title: "当班产出量",
                        dataIndex: "shiftOutputAmount",
                        key: "shiftOutputAmount",
                        align: "center",
                    },
                    {
                        title: "细粉量",
                        dataIndex: "finePowderAmount",
                        key: "finePowderAmount",
                        align: "center",
                    },
                    {
                        title: "辅料名称/辅料量(kg)",
                        dataIndex: "auxiliaryMaterialNameTwo",
                        key: "auxiliaryMaterialNameTwo",
                        align: "center",
                        customRender:(text,record,i)=>{
                            if(record.auxiliaryMaterialNameTwo){
                                let arr
                                arr = JSON.parse(record.auxiliaryMaterialNameTwo)
                                return arr.map((item)=>{
                                    return `${item.name}:${item.value}kg`
                                }).join('、')
                            }else{
                                return "--"
                            }
                        }
                    },
                    {
                        title: "工序",
                        dataIndex: "process",
                        key: "process",
                        align: "center",
                        customRender:(text,record,i)=>{
                            if(record.process){
                                let str
                                str = JSON.parse(record.process)
                                return str  ? str.join('、'):str
                            }else{
                                return "--"
                            }
                        }
                    },
                    {
                        title: "设备",
                        dataIndex: "equipment",
                        key: "equipment",
                        align: "center",
                        customRender:(text,record,i)=>{
                            if(record.equipment){
                                let str
                                str = JSON.parse(record.equipment)
                                return str  ? str.join('、'):str
                            }else{
                                return "--"
                            }
                        }
                    },
                    {
                        title: "规格大小cm",
                        dataIndex: "specificationSizeCm",
                        key: "specificationSizeCm",
                        align: "center",
                    },
                    {
                        title: "开工时间",
                        dataIndex: "startTime",
                        key: "startTime",
                        align: "center",
                    },
                    {
                        title: "实际生产时间",
                        dataIndex: "actualProductionTime",
                        key: "actualProductionTime",
                        align: "center",
                    },
                    {
                        title: "清场时间",
                        dataIndex: "clearingTime",
                        key: "clearingTime",
                        align: "center",
                    },
                    {
                        title: "人员",
                        dataIndex: "personnel",
                        key: "personnel",
                        align: "center",
                    },
                    {
                        title: "工时",
                        dataIndex: "workingHours",
                        key: "workingHours",
                        align: "center",
                    },
                    {
                        title: "操作人",
                        dataIndex: "operator",
                        key: "operator",
                        align: "center",
                        customRender:(text,record,i)=>{
                            return record.operator ? record.operator.join('、'): record.operator
                        }
                    },
                    {
                        title: "设备维修时间",
                        dataIndex: "equipmentMaintenanceTime",
                        key: "equipmentMaintenanceTime",
                        align: "center",
                    },
                    {
                        title: "异常情况",
                        dataIndex: "abnormalCondition",
                        key: "abnormalCondition",
                        align: "center",
                    },
                    {
                        title: "备注",
                        dataIndex: "remarks",
                        key: "remarks",
                        align: "center",
                    },
                    {
                        title:'操作',
                        dataIndex:'action',
                        align: "center",
                        customRender: (text: any, record: any, index: number) => {
                            const editBtn = h('a-button',{
                                style:{marginRight:'5px'},
                                props:{icon:'edit',type:'primary',size:'small'},
                                on:{click:()=>this.edit(record)}
                            },'编辑')
                            const deleteBtn = h('a-popconfirm',
                                {
                                    props:{title:'确定删除该条数据？', okText:'确定', cancelText:'取消'},
                                    on:{confirm:()=>this.remove(record)}
                                },
                            [h('a-button',{props:{icon:'delete',type:'danger',size:'small'},},'删除')])
                            const btn:any[] = []
                            btn.push(editBtn)
                            btn.push(deleteBtn)
                            return h('div',btn)
                        },
                    },
            ]
                this.getTableData()
                this.materialType = '饮片'
                this.type = '半成品'
                break;
            case "提取":
                this.tableOption.tableColumns = [
                        {
                            title:'提取',
                            dataIndex: "extract",
                            key: "extract",
                            align: "center",
                            children:[
                                {
                                    title: "日期",
                                    dataIndex: "productionDate",
                                    key: "productionDate",
                                    align: "center",
                                },
                                {
                                    title: "班次",
                                    dataIndex: "shift",
                                    key: "shift",
                                    align: "center",
                                },
                                {
                                    title: "班长",
                                    dataIndex: "shiftLeader",
                                    key: "shiftLeader",
                                    align: "center",
                                },
                                {
                                    title: "生产线",
                                    dataIndex: "productionLine",
                                    key: "productionLine",
                                    align: "center",
                                },
                                {
                                    title: "品名",
                                    dataIndex: "productName",
                                    key: "productName",
                                    align: "center",
                                },
                                {
                                    title: "批号",
                                    dataIndex: "batchNumber",
                                    key: "batchNumber",
                                    align: "center",
                                },
                                {
                                    title: "药材品名",
                                    dataIndex: "rawMaterialName",
                                    key: "rawMaterialName",
                                    align: "center",
                                },
                                {
                                    title: "生产类型(CW/SY/G/ZCW)",
                                    dataIndex: "productionType",
                                    key: "productionType",
                                    align: "center",
                                },
                                {
                                    title: "物料码",
                                    dataIndex: "materialCode",
                                    key: "materialCode",
                                    align: "center",
                                },
                                {
                                    title: "生产流水号",
                                    dataIndex: "productionSerialNumber",
                                    key: "productionSerialNumber",
                                    align: "center",
                                },
                                {
                                    title: "来料批号",
                                    dataIndex: "materialBatchNumber",
                                    key: "materialBatchNumber",
                                    align: "center",
                                },
                                {
                                    title: "煎煮(kg)",
                                    dataIndex: "boilingAmountKg",
                                    key: "boilingAmountKg",
                                    align: "center",
                                },
                                {
                                    title: "二煎出液时间",
                                    dataIndex: "secondBoilingOutputTime",
                                    key: "secondBoilingOutputTime",
                                    align: "center",
                                },
                                {
                                    title: "每锅投料量(kg)",
                                    dataIndex: "perPotInputAmountKg",
                                    key: "perPotInputAmountKg",
                                    align: "center",
                                },
                                {
                                    title: "投料量",
                                    dataIndex: "inputAmount",
                                    key: "inputAmount",
                                    align: "center",
                                },
                                {
                                    title: "累计投料量",
                                    dataIndex: "cumulativeInputAmount",
                                    key: "cumulativeInputAmount",
                                    align: "center",
                                },
                                {
                                    title: "待料(等待投料)时间(min)",
                                    dataIndex: "waitingForMaterialTimeMin",
                                    key: "waitingForMaterialTimeMin",
                                    align: "center",
                                },
                                {
                                    title: "待料原因",
                                    dataIndex: "waitingForMaterialReason",
                                    key: "waitingForMaterialReason",
                                    align: "center",
                                },
                                {
                                    title: "异常(故障停产)时间(min)",
                                    dataIndex: "abnormalFailureShutdownTimeMin",
                                    key: "abnormalFailureShutdownTimeMin",
                                    align: "center",
                                },
                                {
                                    title: "异常原因",
                                    dataIndex: "abnormalReason",
                                    key: "abnormalReason",
                                    align: "center",
                                },
                            ],
                        },
                        {
                            title:'浓缩',
                            dataIndex: "concentration",
                            key: "concentration",
                            align: "center",
                            children:[
                                {
                                    title: "浓缩(kg)",
                                    dataIndex: "concentrationAmountKg",
                                    key: "concentrationAmountKg",
                                    align: "center",
                                },
                                {
                                    title: "浓缩(h)",
                                    dataIndex: "concentrationTimeH",
                                    key: "concentrationTimeH",
                                    align: "center",
                                },
                                {
                                    title: "出膏用时(h)",
                                    dataIndex: "pasteProductionTimeH",
                                    key: "pasteProductionTimeH",
                                    align: "center",
                                },
                                {
                                    title: "浓缩清场(h)",
                                    dataIndex: "concentrationClearingTimeH",
                                    key: "concentrationClearingTimeH",
                                    align: "center",
                                },
                                {
                                    title: "出膏(kg)",
                                    dataIndex: "pasteOutputAmountKg",
                                    key: "pasteOutputAmountKg",
                                    align: "center",
                                },
                                {
                                    title: "清场(kg)",
                                    dataIndex: "clearingAmountKg",
                                    key: "clearingAmountKg",
                                    align: "center",
                                },
                                {
                                    title: "待料原因",
                                    dataIndex: "waitingForMaterialReason2",
                                    key: "waitingForMaterialReason2",
                                    align: "center",
                                },
                                {
                                    title: "异常(非正常停产)时间(min)",
                                    dataIndex: "abnormalNonNormalShutdownTimeMin",
                                    key: "abnormalNonNormalShutdownTimeMin",
                                    align: "center",
                                },
                                {
                                    title: "异常原因",
                                    dataIndex: "abnormalReason2",
                                    key: "abnormalReason2",
                                    align: "center",
                                },
                            ]
                        },
                        {
                            title: "备注",
                            dataIndex: "remarks",
                            key: "remarks",
                            align: "center",
                        },
                        {
                        title:'操作',
                        dataIndex:'action',
                        align: "center",
                        customRender: (text: any, record: any, index: number) => {
                            const editBtn = h('a-button',{
                                style:{marginRight:'5px'},
                                props:{icon:'edit',type:'primary',size:'small'},
                                on:{click:()=>this.edit(record)}
                            },'编辑')
                            const deleteBtn = h('a-popconfirm',
                                {
                                    props:{title:'确定删除该条数据？', okText:'确定', cancelText:'取消'},
                                    on:{confirm:()=>this.remove(record)}
                                },
                                [h('a-button',{props:{icon:'delete',type:'danger',size:'small'},},'删除')])
                            const btn:any[] = []
                            btn.push(editBtn)
                            btn.push(deleteBtn)
                            return h('div',btn)
                        },
                    },

                    ]
                this.getTableData()
                this.materialType = '提取物'
                this.type = '半成品'
                break;
            case "喷干":
                this.tableOption.tableColumns = [
                    {
                        title: "日期",
                        dataIndex: "productionDate",
                        key: "productionDate",
                        align: "center",
                    },
                    {
                        title: "班次",
                        dataIndex: "shift",
                        key: "shift",
                        align: "center",
                    },
                    {
                        title: "班长",
                        dataIndex: "shiftLeader",
                        key: "shiftLeader",
                        align: "center",
                    },
                    {
                        title: "生产线",
                        dataIndex: "productionLine",
                        key: "productionLine",
                        align: "center",
                    },
                    {
                        title: "品名",
                        dataIndex: "productName",
                        key: "productName",
                        align: "center",
                    },
                    {
                        title: "批号",
                        dataIndex: "batchNumber",
                        key: "batchNumber",
                        align: "center",
                    },
                    {
                        title: "亚批",
                        dataIndex: "secondBatch",
                        key: "secondBatch",
                        align: "center",
                    },
                    {
                        title: "亚批批号",
                        dataIndex: "secondBatchNumber",
                        key: "secondBatchNumber",
                        align: "center",
                    },
                    {
                        title: "原药材品名",
                        dataIndex: "rawMaterialName",
                        key: "rawMaterialName",
                        align: "center",
                    },
                    {
                        title: "生产类型(CW/SY/G/ZCW)",
                        dataIndex: "productionType",
                        key: "productionType",
                        align: "center",
                    },
                    {
                        title: "物料码",
                        dataIndex: "materialCode",
                        key: "materialCode",
                        align: "center",
                    },
                    {
                        title: "生产流水号",
                        dataIndex: "productionSerialNumber",
                        key: "productionSerialNumber",
                        align: "center",
                    },
                    {
                        title: "接班浸膏量(液位mm)",
                        dataIndex: "receptionExtractVolumeMm",
                        key: "receptionExtractVolumeMm",
                        align: "center",
                    },
                    {
                        title: "交班浸膏量（液位mm)",
                        dataIndex: "handoverExtractVolumeMm",
                        key: "handoverExtractVolumeMm",
                        align: "center",
                    },
                    {
                        title: "本批开喷浸膏量（液位mm）",
                        dataIndex: "batchSprayExtractVolumeMm",
                        key: "batchSprayExtractVolumeMm",
                        align: "center",
                    },
                    {
                        title: "麦芽糊精（kg）",
                        dataIndex: "maltodextrin",
                        key: "maltodextrin",
                        align: "center",
                    },
                    {
                        title: "聚维酮（kg）",
                        dataIndex: "povidone",
                        key: "povidone",
                        align: "center",
                    },
                    {
                        title: "二氧化硅（kg）",
                        dataIndex: "siliconDioxide",
                        key: "siliconDioxide",
                        align: "center",
                    },
                    {
                        title: "乳糖（kg）",
                        dataIndex: "lactose",
                        key: "lactose",
                        align: "center",
                    },
                    {
                        title: "收粉量（kg）",
                        dataIndex: "powderCollectionAmount",
                        key: "powderCollectionAmount",
                        align: "center",
                    },
                    {
                        title: "开工准备时间",
                        dataIndex: "startUpTime",
                        key: "startUpTime",
                        align: "center",
                    },
                    {
                        title: "喷干时间",
                        dataIndex: "sprayTime",
                        key: "sprayTime",
                        align: "center",
                    },
                    {
                        title: "配料罐投料（kg）",
                        dataIndex: "tankFeedAmountKg",
                        key: "tankFeedAmountKg",
                        align: "center",
                    },
                    {
                        title: "配料罐过滤（kg）",
                        dataIndex: "tankFilteredAmountKg",
                        key: "tankFilteredAmountKg",
                        align: "center",
                    },
                    {
                        title: "清场（kg）",
                        dataIndex: "clearingAmountKg",
                        key: "clearingAmountKg",
                        align: "center",
                    },
                    {
                        title: "清场时间（小时）",
                        dataIndex: "clearingTimeNum",
                        key: "clearingTimeNum",
                        align: "center",
                    },
                    {
                        title: "清场次数",
                        dataIndex: "clearingCount",
                        key: "clearingCount",
                        align: "center",
                    },
                    {
                        title: "待料（等待浸膏）时间（min）",
                        dataIndex: "waitingExtractTimeMin",
                        key: "waitingExtractTimeMin",
                        align: "center",
                    },
                    {
                        title: "降温铲粉时间（min）",
                        dataIndex: "coolingPowderTimeMin",
                        key: "coolingPowderTimeMin",
                        align: "center",
                    },
                    {
                        title: "清洗雾化器时间（min）",
                        dataIndex: "atomizerCleaningTimeMin",
                        key: "atomizerCleaningTimeMin",
                        align: "center",
                    },
                    {
                        title: "异常（故障停机）时间（min）",
                        dataIndex: "downtimeMin",
                        key: "downtimeMin",
                        align: "center",
                    },
                    {
                        title: "异常原因",
                        dataIndex: "abnormalReason",
                        key: "abnormalReason",
                        align: "center",
                    },
                    {
                        title: "批合计产量",
                        dataIndex: "totalBatchOutput",
                        key: "totalBatchOutput",
                        align: "center",
                    },
                    {
                        title: "备注",
                        dataIndex: "remarks",
                        key: "remarks",
                        align: "center",
                    },
                    {
                        title:'操作',
                        dataIndex:'action',
                        align: "center",
                        customRender: (text: any, record: any, index: number) => {
                            const editBtn = h('a-button',{
                                style:{marginRight:'5px'},
                                props:{icon:'edit',type:'primary',size:'small'},
                                on:{click:()=>this.edit(record)}
                            },'编辑')
                            const deleteBtn = h('a-popconfirm',
                                {
                                    props:{title:'确定删除该条数据？', okText:'确定', cancelText:'取消'},
                                    on:{confirm:()=>this.remove(record)}
                                },
                                [h('a-button',{props:{icon:'delete',type:'danger',size:'small'},},'删除')])
                            const btn:any[] = []
                            btn.push(editBtn)
                            btn.push(deleteBtn)
                            return h('div',btn)
                        },
                    },
                ]
                this.getTableData()
                this.materialType = '提取物'
                this.type = '半成品'
                break;
            case "过筛":
                this.tableOption.tableColumns = [
                    {
                        title: "日期",
                        dataIndex: "productionDate",
                        key: "productionDate",
                        align: "center",
                    },
                    {
                        title: "品名",
                        dataIndex: "productName",
                        key: "productName",
                        align: "center",
                    },
                    {
                        title: "批号",
                        dataIndex: "batchNumber",
                        key: "batchNumber",
                        align: "center",
                    },
                    {
                        title: "原药材品名",
                        dataIndex: "rawMaterialName",
                        key: "rawMaterialName",
                        align: "center",
                    },
                    {
                        title: "生产类型(CW/SY/G/ZCW)",
                        dataIndex: "productionType",
                        key: "productionType",
                        align: "center",
                    },
                    {
                        title: "物料码",
                        dataIndex: "materialCode",
                        key: "materialCode",
                        align: "center",
                    },
                    {
                        title: "生产流水号",
                        dataIndex: "productionSerialNumber",
                        key: "productionSerialNumber",
                        align: "center",
                    },
                    {
                        title:'粗粉量',
                        dataIndex: "coarsePowderAmount",
                        key: "coarsePowderAmount",
                        align: "center",
                    },
                    {
                        title: "麦芽糊精（kg）",
                        dataIndex: "maltodextrin",
                        key: "maltodextrin",
                        align: "center",
                    },
                    {
                        title: "其他辅料",
                        dataIndex: "otherAdditives",
                        key: "otherAdditives",
                        align: "center",
                    },
                    {
                        title: "产出量",
                        dataIndex: "outputAmount",
                        key: "outputAmount",
                        align: "center",
                    },
                    {
                        title: "损耗",
                        dataIndex: "loss",
                        key: "loss",
                        align: "center",
                    },
                    {
                        title: "件数",
                        dataIndex: "quantity",
                        key: "quantity",
                        align: "center",
                    },
                    {
                        title: "开工准备时间(min)",
                        dataIndex: "startUpTime",
                        key: "startUpTime",
                        align: "center",
                    },
                    {
                        title: "生产时间（h）",
                        dataIndex: "productionTime",
                        key: "productionTime",
                        align: "center",
                    },
                    {
                        title: "清场时间(min)",
                        dataIndex: "clearingTimeNum",
                        key: "clearingTimeNum",
                        align: "center",
                    },
                    {
                        title: "生产要求",
                        dataIndex: "productionRequirements",
                        key: "productionRequirements",
                        align: "center",
                    },
                    {
                        title: "备注",
                        dataIndex: "remarks",
                        key: "remarks",
                        align: "center",
                    },
                    {
                        title:'操作',
                        dataIndex:'action',
                        align: "center",
                        customRender: (text: any, record: any, index: number) => {
                            const editBtn = h('a-button',{
                                style:{marginRight:'5px'},
                                props:{icon:'edit',type:'primary',size:'small'},
                                on:{click:()=>this.edit(record)}
                            },'编辑')
                            const deleteBtn = h('a-popconfirm',
                                {
                                    props:{title:'确定删除该条数据？', okText:'确定', cancelText:'取消'},
                                    on:{confirm:()=>this.remove(record)}
                                },
                                [h('a-button',{props:{icon:'delete',type:'danger',size:'small'},},'删除')])
                            const btn:any[] = []
                            btn.push(editBtn)
                            btn.push(deleteBtn)
                            return h('div',btn)
                        },
                    },
                ]
                this.getTableData()
                this.materialType = '提取物'
                this.type = '半成品'
                break;
            case '混一':
                this.tableOption.tableColumns = [
                    {
                        title: "日期",
                        dataIndex: "productionDate",
                        key: "productionDate",
                        align: "center",
                    },
                    {
                        title: "班次",
                        dataIndex: "shift",
                        key: "shift",
                        align: "center",
                    },
                    {
                        title: "生产线",
                        dataIndex: "productionLine",
                        key: "productionLine",
                        align: "center",
                    },
                    {
                        title: "品名",
                        dataIndex: "productName",
                        key: "productName",
                        align: "center",
                    },
                    {
                        title: "批号",
                        dataIndex: "batchNumber",
                        key: "batchNumber",
                        align: "center",
                    },
                    {
                        title: "来料批号",
                        dataIndex: "incomingBatchNumber",
                        key: "incomingBatchNumber",
                        align: "center",
                    },
                    {
                        title: "原药材品名",
                        dataIndex: "rawMaterialName",
                        key: "rawMaterialName",
                        align: "center",
                    },
                    {
                        title: "生产类型(CW/SY/G/ZCW)",
                        dataIndex: "productionType",
                        key: "productionType",
                        align: "center",
                    },
                    {
                        title: "物料码",
                        dataIndex: "materialCode",
                        key: "materialCode",
                        align: "center",
                    },
                    {
                        title: "生产流水号",
                        dataIndex: "productionSerialNumber",
                        key: "productionSerialNumber",
                        align: "center",
                    },
                    {
                        title:'投料量',
                        dataIndex: "inputAmount",
                        key: "inputAmount",
                        align: "center",

                    },
                    {
                        title: "投料量件数",
                        dataIndex: "inputNumber",
                        key: "inputNumber",
                        align: "center",
                    },
                    {
                        title: "预混物",
                        dataIndex: "premix",
                        key: "premix",
                        align: "center",
                    },
                    {
                        title: "辅料名称",
                        dataIndex: "auxiliaryMaterialName",
                        key: "auxiliaryMaterialName",
                        align: "center",
                    },
                    {
                        title: "产出量",
                        dataIndex: "outputAmount",
                        key: "outputAmount",
                        align: "center",
                    },
                    {
                        title: "产出量件数",
                        dataIndex: "outputNumber",
                        key: "outputNumber",
                        align: "center",
                    },
                    {
                        title: "开工准备时间",
                        dataIndex: "startUpTime",
                        key: "startUpTime",
                        align: "center",
                    },
                    {
                        title: "生产时间（h）",
                        dataIndex: "productionTime",
                        key: "productionTime",
                        align: "center",
                    },
                    {
                        title: "清场时间(h)",
                        dataIndex: "clearingTimeNum",
                        key: "clearingTimeNum",
                        align: "center",
                    },
                    {
                        title: "中途停机时间（包含吃饭、休息等）",
                        dataIndex: "midwayDowntime",
                        key: "midwayDowntime",
                        align: "center",
                    },
                    {
                        title: "设备故障时间",
                        dataIndex: "equipmentFailureTime",
                        key: "equipmentFailureTime",
                        align: "center",
                    },
                    {
                        title: "操作人",
                        dataIndex: "operator",
                        key: "operator",
                        align: "center",
                        customRender:(text,record,i)=>{
                            return record.operator ? record.operator.join('、'): record.operator
                        }
                    },
                    {
                        title: "备注（GMP/NGP）",
                        dataIndex: "remarks",
                        key: "remarks",
                        align: "center",
                    },
                    {
                        title:'操作',
                        dataIndex:'action',
                        align: "center",
                        customRender: (text: any, record: any, index: number) => {
                            const editBtn = h('a-button',{
                                style:{marginRight:'5px'},
                                props:{icon:'edit',type:'primary',size:'small'},
                                on:{click:()=>this.edit(record)}
                            },'编辑')
                            const deleteBtn = h('a-popconfirm',
                                {
                                    props:{title:'确定删除该条数据？', okText:'确定', cancelText:'取消'},
                                    on:{confirm:()=>this.remove(record)}
                                },
                                [h('a-button',{props:{icon:'delete',type:'danger',size:'small'},},'删除')])
                            const btn:any[] = []
                            btn.push(editBtn)
                            btn.push(deleteBtn)
                            return h('div',btn)
                        },
                    },
                ]
                this.getTableData()
                this.materialType = '提取物'
                this.type = '半成品'
                break;
            case '混二':
                this.tableOption.tableColumns = [
                    {
                        title: "日期",
                        dataIndex: "productionDate",
                        key: "productionDate",
                        align: "center",
                    },
                    {
                        title: "班次",
                        dataIndex: "shift",
                        key: "shift",
                        align: "center",
                    },
                    {
                        title: "生产线",
                        dataIndex: "productionLine",
                        key: "productionLine",
                        align: "center",
                    },
                    {
                        title: "品名",
                        dataIndex: "productName",
                        key: "productName",
                        align: "center",
                    },
                    {
                        title: "批号",
                        dataIndex: "batchNumber",
                        key: "batchNumber",
                        align: "center",
                    },
                    {
                        title: "来料批号",
                        dataIndex: "incomingBatchNumber",
                        key: "incomingBatchNumber",
                        align: "center",
                    },
                    {
                        title: "原药材品名",
                        dataIndex: "rawMaterialName",
                        key: "rawMaterialName",
                        align: "center",
                    },
                    {
                        title: "生产类型(CW/SY/G/ZCW)",
                        dataIndex: "productionType",
                        key: "productionType",
                        align: "center",
                    },
                    {
                        title: "物料码",
                        dataIndex: "materialCode",
                        key: "materialCode",
                        align: "center",
                    },
                    {
                        title: "生产流水号",
                        dataIndex: "productionSerialNumber",
                        key: "productionSerialNumber",
                        align: "center",
                    },
                    {
                        title: "亚批",
                        dataIndex: "secondBatch",
                        key: "secondBatch",
                        align: "center",
                    },
                    {
                        title:'投料量',
                        dataIndex: "inputAmount",
                        key: "inputAmount",
                        align: "center",
                    },
                    {
                        title: "投料量件数",
                        dataIndex: "inputNumber",
                        key: "inputNumber",
                        align: "center",
                    },
                    {
                        title: "辅料名称",
                        dataIndex: "auxiliaryMaterialName",
                        key: "auxiliaryMaterialName",
                        align: "center",
                    },
                    {
                        title: "预混物",
                        dataIndex: "premix",
                        key: "premix",
                        align: "center",
                    },
                    {
                        title: "产出量",
                        dataIndex: "outputAmount",
                        key: "outputAmount",
                        align: "center",
                    },
                    {
                        title: "产出量件数",
                        dataIndex: "outputNumber",
                        key: "outputNumber",
                        align: "center",
                    },
                    {
                        title: "混合方式（混粉、混颗粒、加挥发油）",
                        dataIndex: "mixingMethod",
                        key: "mixingMethod",
                        align: "center",
                    },
                    {
                        title: "开工准备时间",
                        dataIndex: "startUpTime",
                        key: "startUpTime",
                        align: "center",
                    },
                    {
                        title: "生产时间（h）",
                        dataIndex: "productionTime",
                        key: "productionTime",
                        align: "center",
                    },
                    {
                        title: "清场时间(小时)",
                        dataIndex: "clearingTimeNum",
                        key: "clearingTimeNum",
                        align: "center",
                    },
                    {
                        title: "中途停机时间（包含吃饭、休息等）",
                        dataIndex: "midwayDowntime",
                        key: "midwayDowntime",
                        align: "center",
                    },
                    {
                        title: "设备故障时间",
                        dataIndex: "equipmentFailureTime",
                        key: "equipmentFailureTime",
                        align: "center",
                    },
                    {
                        title: "操作人",
                        dataIndex: "operator",
                        key: "operator",
                        align: "center",
                        customRender:(text,record,i)=>{
                            return record.operator ? record.operator.join('、'): record.operator
                        }
                    },
                    {
                        title: "备注（GMP/NGP）",
                        dataIndex: "remarks",
                        key: "remarks",
                        align: "center",
                    },
                    {
                        title:'操作',
                        dataIndex:'action',
                        align: "center",
                        customRender: (text: any, record: any, index: number) => {
                            const editBtn = h('a-button',{
                                style:{marginRight:'5px'},
                                props:{icon:'edit',type:'primary',size:'small'},
                                on:{click:()=>this.edit(record)}
                            },'编辑')
                            const deleteBtn = h('a-popconfirm',
                                {
                                    props:{title:'确定删除该条数据？', okText:'确定', cancelText:'取消'},
                                    on:{confirm:()=>this.remove(record)}
                                },
                                [h('a-button',{props:{icon:'delete',type:'danger',size:'small'},},'删除')])
                            const btn:any[] = []
                            btn.push(editBtn)
                            btn.push(deleteBtn)
                            return h('div',btn)
                        },
                    },

                ]
                this.getTableData()
                this.materialType = ''
                this.type = '待包装成品'
                break;
            case '制粒':
                this.tableOption.tableColumns = [
                    {
                        title: "日期",
                        dataIndex: "productionDate",
                        key: "productionDate",
                        align: "center",
                    },
                    {
                        title: "班次",
                        dataIndex: "shift",
                        key: "shift",
                        align: "center",
                    },
                    {
                        title: "生产线",
                        dataIndex: "productionLine",
                        key: "productionLine",
                        align: "center",
                    },
                    {
                        title: "品名",
                        dataIndex: "productName",
                        key: "productName",
                        align: "center",
                    },
                    {
                        title: "批号",
                        dataIndex: "batchNumber",
                        key: "batchNumber",
                        align: "center",
                    },
                    {
                        title: "亚批",
                        dataIndex: "secondBatch",
                        key: "secondBatch",
                        align: "center",
                    },
                    {
                        title: "生产批号",
                        dataIndex: "productionBatch",
                        key: "productionBatch",
                        align: "center",
                    },
                    {
                        title: "生产类型(CW/SY/G/ZCW)",
                        dataIndex: "productionType",
                        key: "productionType",
                        align: "center",
                    },
                    {
                        title: "原药材品名",
                        dataIndex: "rawMaterialName",
                        key: "rawMaterialName",
                        align: "center",
                    },
                    {
                        title: "物料码",
                        dataIndex: "materialCode",
                        key: "materialCode",
                        align: "center",
                    },
                    {
                        title: "生产流水号",
                        dataIndex: "productionSerialNumber",
                        key: "productionSerialNumber",
                        align: "center",
                    },
                    {
                        title:'投料量',
                        dataIndex: "inputAmount",
                        key: "inputAmount",
                        align: "center",
                    },
                    {
                        title: "过筛量",
                        dataIndex: "screeningAmount",
                        key: "screeningAmount",
                        align: "center",
                    },
                    {
                        title: "目标产量",
                        dataIndex: "targetOutput",
                        key: "targetOutput",
                        align: "center",
                    },
                    {
                        title: "产出量",
                        dataIndex: "outputAmount",
                        key: "outputAmount",
                        align: "center",
                    },
                    {
                        title: "累计产出量",
                        dataIndex: "cumulativeOutput",
                        key: "cumulativeOutput",
                        align: "center",
                    },
                    {
                        title: "尾料",
                        dataIndex: "tailMaterial",
                        key: "tailMaterial",
                        align: "center",
                    },
                    {
                        title: "损耗",
                        dataIndex: "loss",
                        key: "loss",
                        align: "center",
                    },
                    {
                        title: "开工准备时间",
                        dataIndex: "startUpTime",
                        key: "startUpTime",
                        align: "center",
                    },
                    {
                        title: "生产时间（h）",
                        dataIndex: "productionTime",
                        key: "productionTime",
                        align: "center",
                    },
                    {
                        title: "中途停机时间（包含吃饭、休息等）",
                        dataIndex: "midwayDowntime",
                        key: "midwayDowntime",
                        align: "center",
                    },
                    {
                        title: "消毒上器具(h)",
                        dataIndex: "upAppliance",
                        key: "upAppliance",
                        align: "center",
                    },
                    {
                        title: "消毒下器具(h)",
                        dataIndex: "downAppliance",
                        key: "downAppliance",
                        align: "center",
                    },
                    {
                        title: "中途停机原因",
                        dataIndex: "midwayHaltCause",
                        key: "midwayHaltCause",
                        align: "center",
                    },
                    {
                        title: "清场时间(小时)",
                        dataIndex: "clearingTimeNum",
                        key: "clearingTimeNum",
                        align: "center",
                    },
                    {
                        title: "设备故障时间",
                        dataIndex: "equipmentFailureTime",
                        key: "equipmentFailureTime",
                        align: "center",
                    },
                    {
                        title: "操作人",
                        dataIndex: "operator",
                        key: "operator",
                        align: "center",
                        customRender:(text,record,i)=>{
                            return record.operator ? record.operator.join('、'): record.operator
                        }
                    },
                    {
                        title: "班长",
                        dataIndex: "shiftLeader",
                        key: "shiftLeader",
                        align: "center",
                    },
                    {
                        title: "备注",
                        dataIndex: "remarks",
                        key: "remarks",
                        align: "center",
                    },
                    {
                        title:'操作',
                        dataIndex:'action',
                        align: "center",
                        customRender: (text: any, record: any, index: number) => {
                            const editBtn = h('a-button',{
                                style:{marginRight:'5px'},
                                props:{icon:'edit',type:'primary',size:'small'},
                                on:{click:()=>this.edit(record)}
                            },'编辑')
                            const deleteBtn = h('a-popconfirm',
                                {
                                    props:{title:'确定删除该条数据？', okText:'确定', cancelText:'取消'},
                                    on:{confirm:()=>this.remove(record)}
                                },
                                [h('a-button',{props:{icon:'delete',type:'danger',size:'small'},},'删除')])
                            const btn:any[] = []
                            btn.push(editBtn)
                            btn.push(deleteBtn)
                            return h('div',btn)
                        },
                    },
                ]
                this.getTableData()
                this.materialType = '配方颗粒(颗粒)'
                this.type = '待包装成品'
                break;
            case "小袋分装":
                this.tableOption.tableColumns = [
                    {
                        title: "日期",
                        dataIndex: "productionDate",
                        key: "productionDate",
                        align: "center",
                    },
                    {
                        title: "班次",
                        dataIndex: "shift",
                        key: "shift",
                        align: "center",
                    },
                    {
                        title: "生产线",
                        dataIndex: "productionLine",
                        key: "productionLine",
                        align: "center",
                    },
                    {
                        title: "设备编号",
                        dataIndex: "equipmentId",
                        key: "equipmentId",
                        align: "center",
                    },
                    {
                        title: "品名",
                        dataIndex: "productName",
                        key: "productName",
                        align: "center",
                    },
                    {
                        title:'来料批号',
                        dataIndex: "incomingBatchNumber",
                        key: "incomingBatchNumber",
                        align: "center",
                    },
                    {
                        title:'成品批号',
                        dataIndex: "finishedProductBatchNumber",
                        key: "finishedProductBatchNumber",
                        align: "center",
                    },
                    {
                        title: "生产类型(C60/C80/C61/C81)",
                        dataIndex: "productionType",
                        key: "productionType",
                        align: "center",
                    },
                    {
                        title:'规格',
                        dataIndex: "specification",
                        key: "specification",
                        align: "center",
                    },
                    {
                        title:'装量',
                        dataIndex: "loadingQuantity",
                        key: "loadingQuantity",
                        align: "center",
                    },
                    {
                        title:'理论袋数',
                        dataIndex: "theoreticalBagCount",
                        key: "theoreticalBagCount",
                        align: "center",
                    },
                    {
                        title:'颗粒',
                        align: "center",
                        children:[
                            {
                                title:'领料量',
                                dataIndex: "materialInputAmount",
                                key: "materialInputAmount",
                                align: "center",
                            },
                            {
                                title:'退料量',
                                dataIndex: "materialReturnAmount",
                                key: "materialReturnAmount",
                                align: "center",
                            },
                            {
                                title:'尾料量',
                                dataIndex: "tailMaterialAmount",
                                key: "tailMaterialAmount",
                                align: "center",
                            },
                        ]
                    },
                    {
                        title:'包材',
                        align: "center",
                        children:[
                            {
                                title:'包材领用量kg',
                                dataIndex: "packagingMaterialUsage",
                                key: "packagingMaterialUsage",
                                align: "center",
                            },
                            {
                                title:'包材退库量kg',
                                dataIndex: "packagingMaterialReturn",
                                key: "packagingMaterialReturn",
                                align: "center",
                            },
                            {
                                title:'废包材量kg',
                                dataIndex: "wastePackagingMaterial",
                                key: "wastePackagingMaterial",
                                align: "center",
                            },
                            {
                                title:'包材净用量kg',
                                dataIndex: "netPackagingUsage",
                                key: "netPackagingUsage",
                                align: "center",
                            },
                        ]
                    },
                    {
                        title:'产出',
                        align: "center",
                        children:[
                            {
                                title:'产出数量',
                                dataIndex: "outputQuantity",
                                key: "outputQuantity",
                                align: "center",
                            },
                            {
                                title:'件数',
                                dataIndex: "quantity",
                                key: "quantity",
                                align: "center",
                            },
                            {
                                title:'取样量',
                                dataIndex: "samplingAmount",
                                key: "samplingAmount",
                                align: "center",
                            },
                        ]
                    },
                    {
                        title:'打码产量',
                        dataIndex: "codeYield",
                        key: "codeYield",
                        align: "center",
                    },
                    {
                        title:'准备时间',
                        dataIndex: "preparationTime",
                        key: "preparationTime",
                        align: "center",
                    },
                    {
                        title:'清场时间（小时）',
                        dataIndex: "clearingTimeNum",
                        key: "clearingTimeNum",
                        align: "center",
                    },
                    {
                        title:'清场备注',
                        dataIndex: "clearingRemarks",
                        key: "clearingRemarks",
                        align: "center",
                    },
                    {
                        title:'设备运行时间（小时）',
                        dataIndex: "equipmentRuntime",
                        key: "equipmentRuntime",
                        align: "center",
                    },
                    {
                        title:'停机时间（小时）',
                        dataIndex: "downtime",
                        key: "downtime",
                        align: "center",
                    },
                    {
                        title:'中途停机原因（吃饭、停压缩空气、待料休息等）',
                        dataIndex: "downtimeReason",
                        key: "downtimeReason",
                        align: "center",
                    },
                    {
                        title:'设备故障停机时间（等待和维修时间）',
                        dataIndex: "equipmentFailureDowntime",
                        key: "equipmentFailureDowntime",
                        align: "center",
                    },
                    {
                        title:'故障原因',
                        dataIndex: "failureReason",
                        key: "failureReason",
                        align: "center",
                    },
                    {
                        title: "操作人",
                        dataIndex: "operator",
                        key: "operator",
                        align: "center",
                        customRender:(text,record,i)=>{
                            return record.operator ? record.operator.join('、'): record.operator
                        }
                    },
                    {
                        title: "班长",
                        dataIndex: "shiftLeader",
                        key: "shiftLeader",
                        align: "center",
                    },
                    {
                        title:'备注',
                        dataIndex: "remarks",
                        key: "remarks",
                        align: "center",
                    },
                    {
                        title:'操作',
                        dataIndex:'action',
                        align: "center",
                        customRender: (text: any, record: any, index: number) => {
                            const editBtn = h('a-button',{
                                style:{marginRight:'5px'},
                                props:{icon:'edit',type:'primary',size:'small'},
                                on:{click:()=>this.edit(record)}
                            },'编辑')
                            const deleteBtn = h('a-popconfirm',
                                {
                                    props:{title:'确定删除该条数据？', okText:'确定', cancelText:'取消'},
                                    on:{confirm:()=>this.remove(record)}
                                },
                                [h('a-button',{props:{icon:'delete',type:'danger',size:'small'},},'删除')])
                            const btn:any[] = []
                            btn.push(editBtn)
                            btn.push(deleteBtn)
                            return h('div',btn)
                        },
                    },
                ]
                this.getTableData()
                this.materialType = ''
                this.type = '成品'
                break;
            case "大袋分装":
                this.tableOption.tableColumns = [
                    {
                        title: "日期",
                        dataIndex: "productionDate",
                        key: "productionDate",
                        align: "center",
                    },
                    {
                        title: "班次",
                        dataIndex: "shift",
                        key: "shift",
                        align: "center",
                    },
                    {
                        title: "生产线",
                        dataIndex: "productionLine",
                        key: "productionLine",
                        align: "center",
                    },
                    {
                        title: "设备编号",
                        dataIndex: "equipmentId",
                        key: "equipmentId",
                        align: "center",
                    },
                    {
                        title: "品名",
                        dataIndex: "productName",
                        key: "productName",
                        align: "center",
                    },
                    {
                        title:'成品批号',
                        dataIndex: "finishedProductBatchNumber",
                        key: "finishedProductBatchNumber",
                        align: "center",
                    },
                    {
                        title:'来料批号',
                        dataIndex: "incomingBatchNumber",
                        key: "incomingBatchNumber",
                        align: "center",
                    },
                    {
                        title: "生产类型(C60/C80/C61/C81)",
                        dataIndex: "productionType",
                        key: "productionType",
                        align: "center",
                    },
                    {
                        title:'装量kg',
                        dataIndex: "loadingQuantity",
                        key: "loadingQuantity",
                        align: "center",
                    },
                    {
                        title:'产量kg',
                        dataIndex: "yield",
                        key: "yield",
                        align: "center",
                    },
                    {
                        title:'取样留样量kg',
                        dataIndex: "samplingReservedSampleNumber",
                        key: "samplingReservedSampleNumber",
                        align: "center",
                    },
                    {
                        title:'领料量kg',
                        dataIndex: "materialInputAmount",
                        key: "materialInputAmount",
                        align: "center",
                    },
                    {
                        title:'退料量kg',
                        dataIndex: "materialReturnAmount",
                        key: "materialReturnAmount",
                        align: "center",
                    },
                    {
                        title:'尾料量kg',
                        dataIndex: "tailMaterialAmount",
                        key: "tailMaterialAmount",
                        align: "center",
                    },
                    {
                        title:'包材领用量kg',
                        dataIndex: "packagingMaterialUsage",
                        key: "packagingMaterialUsage",
                        align: "center",
                    },
                    {
                        title:'包材退库量kg',
                        dataIndex: "packagingMaterialReturn",
                        key: "packagingMaterialReturn",
                        align: "center",
                    },
                    {
                        title:'废包材',
                        dataIndex: "wastePackagingMaterial",
                        key: "wastePackagingMaterial",
                        align: "center",
                    },
                    {
                        title:'包材净用量kg',
                        dataIndex: "netPackagingUsage",
                        key: "netPackagingUsage",
                        align: "center",
                    },
                    {
                        title: "开工准备时间",
                        dataIndex: "startUpTime",
                        key: "startUpTime",
                        align: "center",
                    },
                    {
                        title:'设备运行时间（小时）',
                        dataIndex: "equipmentRuntime",
                        key: "equipmentRuntime",
                        align: "center",
                    },
                    {
                        title:'清场时间（小时）',
                        dataIndex: "clearingTimeNum",
                        key: "clearingTimeNum",
                        align: "center",
                    },
                    {
                        title:'清场备注',
                        dataIndex: "clearingRemarks",
                        key: "clearingRemarks",
                        align: "center",
                    },
                    {
                        title:'设备故障停机时间（等待和维修时间）',
                        dataIndex: "equipmentFailureDowntime",
                        key: "equipmentFailureDowntime",
                        align: "center",
                    },
                    {
                        title:'故障原因',
                        dataIndex: "failureReason",
                        key: "failureReason",
                        align: "center",
                    },
                    {
                        title: "中途停机时间（包含吃饭、休息等）",
                        dataIndex: "midwayDowntime",
                        key: "midwayDowntime",
                        align: "center",
                    },
                    {
                        title:'中途停机原因（吃饭、停压缩空气、待料休息等）',
                        dataIndex: "downtimeReason",
                        key: "downtimeReason",
                        align: "center",
                    },
                    {
                        title:'设备操作人员',
                        dataIndex: "equipmentOperationStaffJson",
                        key: "equipmentOperationStaffJson",
                        align: "center",
                        customRender:(text,record,i)=>{
                            return record.equipmentOperationStaffJson ? record.equipmentOperationStaffJson.join('、'): record.equipmentOperationStaffJson
                        }
                    },
                    {
                        title:'摆单包人员',
                        dataIndex: "swingPackStaffJson",
                        key: "swingPackStaffJson",
                        align: "center",
                        customRender:(text,record,i)=>{
                            return record.swingPackStaffJson ? record.swingPackStaffJson.join('、'): record.swingPackStaffJson
                        }
                    },
                    {
                        title:'包中包人员',
                        dataIndex: "bagInBagStaffJson",
                        key: "bagInBagStaffJson",
                        align: "center",
                        customRender:(text,record,i)=>{
                            return record.bagInBagStaffJson ? record.bagInBagStaffJson.join('、'): record.bagInBagStaffJson
                        }
                    },
                    {
                        title: "班长",
                        dataIndex: "shiftLeader",
                        key: "shiftLeader",
                        align: "center",
                    },
                    {
                        title:'备注',
                        dataIndex: "remarks",
                        key: "remarks",
                        align: "center",
                    },
                    {
                        title:'操作',
                        dataIndex:'action',
                        align: "center",
                        customRender: (text: any, record: any, index: number) => {
                            const editBtn = h('a-button',{
                                style:{marginRight:'5px'},
                                props:{icon:'edit',type:'primary',size:'small'},
                                on:{click:()=>this.edit(record)}
                            },'编辑')
                            const deleteBtn = h('a-popconfirm',
                                {
                                    props:{title:'确定删除该条数据？', okText:'确定', cancelText:'取消'},
                                    on:{confirm:()=>this.remove(record)}
                                },
                                [h('a-button',{props:{icon:'delete',type:'danger',size:'small'},},'删除')])
                            const btn:any[] = []
                            btn.push(editBtn)
                            btn.push(deleteBtn)
                            return h('div',btn)
                        },
                    },
                ]
                this.getTableData()
                this.materialType = ''
                this.type = '成品'
                break;
            case "小袋外包":
                this.tableOption.tableColumns = [
                    {
                        title: "日期",
                        dataIndex: "productionDate",
                        key: "productionDate",
                        align: "center",
                    },
                    {
                        title: "房间编号",
                        dataIndex:"roomNumber",
                        key: "roomNumber",
                        align: "center",
                    },
                    {
                        title:"品名",
                        dataIndex:"productName",
                        key:"productName",
                        align:"center"
                    },
                    {
                        title:"批号",
                        dataIndex:"batchNumber",
                        key:"batchNumber",
                        align:"center",
                    },
                    {
                        title:"生产类型(C60/C80/C61/C81)",
                        dataIndex:"productionType",
                        key:"productionType",
                        align:"center",
                    },
                    {
                        title:"产出量",
                        dataIndex:"outputAmount",
                        key:"outputAmount",
                        align:"center",
                    },
                    {
                        title:"备注",
                        dataIndex:"remarks",
                        key:"remarks",
                        align:"center",
                    },
                    {
                        title:'操作',
                        dataIndex:'action',
                        align: "center",
                        customRender: (text: any, record: any, index: number) => {
                            const editBtn = h('a-button',{
                                style:{marginRight:'5px'},
                                props:{icon:'edit',type:'primary',size:'small'},
                                on:{click:()=>this.edit(record)}
                            },'编辑')
                            const deleteBtn = h('a-popconfirm',
                                {
                                    props:{title:'确定删除该条数据？', okText:'确定', cancelText:'取消'},
                                    on:{confirm:()=>this.remove(record)}
                                },
                                [h('a-button',{props:{icon:'delete',type:'danger',size:'small'},},'删除')])
                            const btn:any[] = []
                            btn.push(editBtn)
                            btn.push(deleteBtn)
                            return h('div',btn)
                        },
                    },
                ]
                this.getTableData()
                this.materialType = ''
                this.type = '成品'
                break;
            case "大袋外包":
                this.tableOption.tableColumns = [
                    {
                        title: "日期",
                        dataIndex: "productionDate",
                        key: "productionDate",
                        align: "center",
                    },
                    {
                        title: "房间编号",
                        dataIndex:"roomNumber",
                        key: "roomNumber",
                        align: "center",
                    },
                    {
                        title:"品名",
                        dataIndex:"productName",
                        key:"productName",
                        align:"center"
                    },
                    {
                        title:"批号",
                        dataIndex:"batchNumber",
                        key:"batchNumber",
                        align:"center",
                    },
                    {
                        title:"生产类型(C70/C90/C71)",
                        dataIndex:"productionType",
                        key:"productionType",
                        align:"center",
                    },
                    {
                        title:"成品量",
                        dataIndex:"finishedProductNumber",
                        key:"finishedProductNumber",
                        align:"center",
                    },
                    {
                        title:"备注",
                        dataIndex:"remarks",
                        key:"remarks",
                        align:"center",
                    },
                    {
                        title:'操作',
                        dataIndex:'action',
                        align: "center",
                        customRender: (text: any, record: any, index: number) => {
                            const editBtn = h('a-button',{
                                style:{marginRight:'5px'},
                                props:{icon:'edit',type:'primary',size:'small'},
                                on:{click:()=>this.edit(record)}
                            },'编辑')
                            const deleteBtn = h('a-popconfirm',
                                {
                                    props:{title:'确定删除该条数据？', okText:'确定', cancelText:'取消'},
                                    on:{confirm:()=>this.remove(record)}
                                },
                                [h('a-button',{props:{icon:'delete',type:'danger',size:'small'},},'删除')])
                            const btn:any[] = []
                            btn.push(editBtn)
                            btn.push(deleteBtn)
                            return h('div',btn)
                        },
                    },
                ]
                this.getTableData()
                this.materialType = ''
                this.type = '成品'
                break;
            default:
                this.tableOption.tableColumns = []
                this.tableOption.tableData = []
        }


        this.tableOption.tableColumns.forEach(item=>{
            item.width = 150
            if(item.children){
                item.children.forEach(jack=>{
                    jack.width = 150
                })
            }
        })
        let tableColLastEleIndex:number = this.tableOption.tableColumns.length-1
        this.tableOption.tableColumns[tableColLastEleIndex].children ? this.tableOption.tableColumns[tableColLastEleIndex].children[this.tableOption.tableColumns[tableColLastEleIndex].children.length-1].width = 220:this.tableOption.tableColumns[tableColLastEleIndex].width = 220
    }
    async getTableData(){
        this.tableOption.loading = true
        try{
            const res = await nextApi.getProductionTableList({type:this.curTab,statementInfoId:this.editId})
            this.tableOption.tableData = res.data?.rows || []
        }catch (e){
            throw e
        }finally {
            this.tableOption.loading = false
        }

    }
    //新增弹窗
    formShow  = false
    statementInfoId = ''
    add(){
        this.formShow = true
        this.statementInfoId = this.editId
    }
    //编辑弹窗
    formEditId = ''
    edit(record){
        this.formShow = true
        this.formEditId = record.id
        this.statementInfoId = this.editId
    }
    //删除
    async remove(record){
        console.log('删除id:',record.id)
        const res = await nextApi.removeStatement({id:record.id})
        if(res.code == 200){
            this.$message.success("删除成功")
            await this.getTableData()
        }

    }
    //表单关闭
    formClose(){
        this.formShow = false
        this.formEditId = ''
        this.tabChange(this.curTab)
    }
    closeModal(){
        this.$emit("closeModal");
    }
}
</script>
<style scoped lang="scss">
.table-container{
    margin: 20px 0;
}
.ant-table td { white-space: nowrap; }
</style>
